#!/usr/bin/env python
#-*- coding:utf-8 -*-

# file: L0Q1.py

import sys

def process(n):
    results = []
    while n != 1:
        results.append(n)
        if n % 2:
            n = 3 * n + 1
        else:
            n = n / 2

    results.append(n)

    return results

def read_input(filename):
    f = open(filename, "r")
    lines = f.readlines()
    f.close()

    values = []
    for line in lines:
            item = tuple([int(n) for n in line.split(' ')])
            values.append(item)

    return values


def main():
    if len(sys.argv) > 1:
        input_file = sys.argv[1]
    else:
        input_file = sys.argv[0]
        start = input_file.rfind('/') + 1
        end = input_file.rfind('.py')
        input_file = input_file[start:end] + '.in'

    try:
        input = read_input(input_file)
    except IOError, e:
        print 'Arquivo de entrada "%s" nao encontrado.' % \
                input_file
        sys.exit(1)

    for data in input:
        value = 0
        start, end = data
        for n in range(start, end + 1):
               tmp = len(process(n))
               if tmp > value:
                       value = tmp

        print '%d %d %d' % (start, end, value)


if __name__ == '__main__':
    main()
